<template>
	<view>
		<u-navbar :is-back="true" title="修改密码"></u-navbar>
		<view class="xiugaimima-form">
			<u-form  ref="uForm" >
				<u-form-item class="form-item" style="margin-top: 20rpx;" :rightIconStyle="{color: '#888', fontSize: '32rpx'}"   label="旧密码" prop="phone" label-width="150">
					<u-input :border="border" placeholder="输入原始密码" v-model="old" type="password"></u-input>
				</u-form-item>
				<u-form-item  label="新密码" prop="password"  label-width="150" style="margin-top: 20rpx;">
					<u-input :password-icon="false" :border="border" type="password" v-model="password" placeholder="输入新密码"></u-input>
				</u-form-item>
			</u-form>
			<view class="lijidenglu">
				<u-button shape="circle" class="ljdl-btn" @click="doup()">立即修改</u-button>
			</view>
		</view>
		<tarBer :totarBer='tar'></tarBer>
	</view>
</template>

<script>
	import tarBer from '../../components/tabBarFoot/tabBarFoot.vue'
	import { mapState,mapMutations} from 'vuex';
	export default {
		components:{
				 tarBer
			 },
		data() {
			return {
				tar:{
						color:'#fff',
						id:1		 
				},
				old:'',
				password:'',
				border:false
			};
		},
		methods:{
			doup(){
				if (!this.old) {
					this.$toast('请输入原始密码');
					return false;
				}
				if (!this.password) {
					this.$toast('请输入密码');
					return false;
				}
				let params={
					old:this.old,
					password:this.password,
				};
				this.$ajax.post('member/uppwd',params).then(data=>{
					this.$api.msg(data.msg);
					if(0==data.error){
						setTimeout(function(){
							return uni.switchTab({
								url:'/pages/user/user'
							})
						},300)
					}
					
				})
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #ebebeb;
}
.xiugaimima-form{
	margin-top: 30rpx;
	background-color: #FFFFFF;
	padding: 100rpx 75rpx;
}
.lijidenglu{
	margin-top: 85rpx;
	margin-bottom: 85rpx;
	.ljdl-btn{
		font-size: 30rpx;
		margin: 0 45rpx;
		color: #2ea34a;
	}
	.ljdl-btn:after{
		border:1px solid #dfdfdf;
	}
}
</style>
